#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int P = 30007;
const int Sz = 1e6+10;
const int offset = 3;
const int mask = (1<<offset) - 1;

const int N = 15;

int n,m,bb[N],bn,b[N],lascani,lascanj;
bool ban[N][N];
char s[N];
ll d;

struct hashtable{
	int h[P],sz,nxt[Sz];
	ll key[Sz],state[Sz];
	void clear(){memset(h,-1,sizeof(h));sz = 0;}
	void push(ll s){
		int x = s % P;
		for(int i = h[x];~i;i = nxt[i]){
			if(state[i] == s){
				key[i] += d;
				return;
			}
		}
		state[sz] = s; key[sz] = d; nxt[sz] = h[x]; h[x] = sz++;
	}
	void roll(){for(int i = 0;i < sz;i++) state[i] <<= offset;}		
}h[2],*h0,*h1;

void decode(ll s){
	for(int i = 0;i <= m;i++){
		b[i] = s & mask;
		s >>= offset;
	}
}

ll encode(){
	memset(bb,-1,sizeof(bb)); bn = 1; bb[0] = 0; ll s = 0;
	for(int i = m;~i;i--){
		if(!~bb[b[i]]) bb[b[i]] = bn++;
		 s <<= offset; s |= bb[b[i]];
	}
	return s;
}

void push(int j,int x,int y){
	b[j] = x; b[j+1] = y;
	h1 -> push(encode());
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in;
	for(int i = 0;i < n;i++){
		scanf("%s",s);
		for(int j = 0;j < m;j++){
			ban[i][j] = s[j] == '*';
			if(!ban[i][j]){
				lascani = i;
				lascanj = j;
			}
		}
	}
	d = 1; h0 = h; h1 = h+1; h1 -> clear(); h1 -> push(0);
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			swap(h0,h1); h1 -> clear();
			int down = (i != n-1 && !ban[i+1][j]) ,right = (j != m-1 && !ban[i][j+1]);
			for(int t = 0;t < h0 -> sz;t++){
				decode(h0 -> state[t]);
				d = h0 -> key[t];
				int left = b[j],up = b[j+1];
				if(ban[i][j]){
					push(j,0,0);
				}else{
					if(left && up){
						if(left == up){
							if(i == lascani && j == lascanj){
								push(j,0,0);
							}
						}else{
							for(int k = 0;k <= m;k++) if(b[k] == left) b[k] = up;
							push(j,0,0);
						}
					}else if(left || up){
						int st = left | up;
						if(down) push(j,st,0);
						if(right) push(j,0,st);
					}else {
						if(down && right) push(j,m,m);
					}
				}
			}
		}
		h1 -> roll();
	}
	printf("%lld\n",h1 -> sz == 1 ? h1 -> key[0] : 0);
	return 0;
}
